package com.news.service;

import java.util.List;

import com.news.dao.NewsDao;
import com.news.entity.News;
import com.news.util.PageModel;

public class NewsServiceImpl implements NewsService {

	private NewsDao newsDao;

	@Override
	public void setNewsDao(NewsDao newsDao) {
		this.newsDao = newsDao;
	}

	@Override
	public List<News> getAllNews(Integer currentPage, Integer rows) {
		return newsDao.getAllNews(currentPage, rows);
	}

	@Override
	public PageModel getPageModel(Integer currentPage, Integer rows) {
		return newsDao.getPageModel(currentPage, rows);
	}

	@Override
	public List<News> getAllNewsByPid(Integer currentPage, Integer rows, int pid) {
		return newsDao.getAllNewsByPid(currentPage, rows, pid);
	}

	@Override
	public PageModel getPageModelByPid(Integer currentPage, Integer rows,
			int pid) {
		return newsDao.getPageModelByPid(currentPage, rows, pid);
	}

	@Override
	public void addNews(News news) {

		newsDao.addNews(news);
	}

	@Override
	public boolean delNews(int newsid) {

		return newsDao.delUser(newsid);
	}

	@Override
	public News getNews(int newsid) {

		return newsDao.getNews(newsid);
	}

	@Override
	public boolean updateNews(News news) {

		return newsDao.updateNews(news);
	}

}
